package com.qf.mytoubuju;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/1/6.
 */
public class MyAdapter extends BaseAdapter{

    private Context context;
    private ArrayList<Data1> list;

    public MyAdapter(Context context, ArrayList<Data1> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final ViewHolder vh3;
        if (convertView == null) {
            convertView = View.inflate(context, R.layout.item, null);
            vh3 = new ViewHolder();
            vh3.tv1 = (TextView) convertView.findViewById(R.id.tv1);

            convertView.setTag(vh3);
        } else {
            vh3 = (ViewHolder) convertView.getTag();
        }
        Data1 data = list.get(position);
        vh3.tv1.setText(data.name);
        return convertView;
    }
    class ViewHolder{
        TextView tv1;
    }
}
